import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mypeiwan/widgets/general_setting/my_behavior.dart';
import 'package:mypeiwan/widgets/components/dynamic_time.dart';
import 'package:mypeiwan/widgets/components/dynamic_distance.dart';

class PeiwanshiPage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return _PeiwanshiPageState();
  }

}
class _PeiwanshiPageState extends State<PeiwanshiPage>{
  late MediaQueryData queryData;
  ScrollController _scrollController = ScrollController();
  //   0最新 1离我最近
  int TabbarIndex=0;
  bool showLoading=false;
//  登录用户头像
  String avatar='https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F1e0466ff-3a60-4544-9630-318439662daf%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695729181&t=936ac3d7a19e38b4ba2adb1a1772c0fa';
//登录用户昵称
  String nickname='武则天';
  //  评论内容
  String commentContent='';
//  发布评论按钮状态 0不可控 1可控
  int btnStatus=0;
//  总列表
  List list=[];
  //  置顶列表-最新
  List topListNew=[
    {
      // 头像
      'avatar':"https://img1.baidu.com/it/u=3768804500,181908195&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
      // 昵称
      'nickName':'小川',
      // 性别 1男 2女
      'gender':1,
      // 年龄
      'age':22,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':3,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'15985',
      // 时间
      'createAt':1693139194,
      // 文字内容
      'content':'今天天气真好，一起玩游戏吧。今天天气真好，一起玩游戏吧。今天天气真好，一起玩游戏吧。',
      // 图片内容
      'images':[],
      // 点赞数
      'like':52289,
      // 评论数
      'comment':1628,
      // 是否置顶
      'isTopping':true,
      // 显示评论框
      'showComment':false,
      'id':3
    },
    {
      // 头像
      'avatar':"https://img2.baidu.com/it/u=175449109,3788073609&fm=253&fmt=auto&app=138&f=JPEG?w=561&h=500",
      // 昵称
      'nickName':'安琪拉',
      // 性别 1男 2女
      'gender':2,
      // 年龄
      'age':24,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':1,
      // 用户是否会员
      'isMember':true,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':5,
      // 距离
      'distance':'28',
      // 时间
      'createAt':1693139070,
      // 文字内容
      'content':'我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！',
      // 图片内容
      'images':['https://img2.baidu.com/it/u=638285213,1746517464&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800','https://img2.baidu.com/it/u=862159221,1723036925&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500'],
      // 点赞数
      'like':80,
      // 评论数
      'comment':62,
      // 是否置顶
      'isTopping':true,
      // 显示评论框
      'showComment':false,
      'id':2
    },
    {
      // 头像
      'avatar':"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F9e18d14b-8a44-41b0-97d9-6aed05b70e7f%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695714475&t=e7c29cfaa789fa7cc199601e91d23b2a",
      // 昵称
      'nickName':'琪琪',
      // 性别 1男 2女
      'gender':2,
      // 年龄
      'age':18,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':1,
      // 用户是否会员
      'isMember':true,
      // 是否超级会员
      'isSvip':true,
      // 如用户是会员 会员等级
      'level':2,
      // 距离
      'distance':'856',
      // 时间
      'createAt':1693122984,
      // 文字内容
      'content':'欢迎光临',
      // 图片内容
      'images':['https://img0.baidu.com/it/u=1604010673,2427861166&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889'],
      // 点赞数
      'like':289,
      // 评论数
      'comment':162,
      // 是否置顶
      'isTopping':true,
      // 显示评论框
      'showComment':false,
      'id':1
    },
  ];
//  普通列表-最新
  List normalListNew=[
    {
      // 头像
      'avatar':"https://img0.baidu.com/it/u=4046953384,453855082&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
      // 昵称
      'nickName':'小玲小龙',
      // 性别 1男 2女
      'gender':2,
      // 年龄
      'age':28,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':2,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'2688',
      // 时间
      'createAt':1693139480,
      // 文字内容
      'content':'有人走向海 ，有人走向山 ，都是好风光。',
      // 图片内容
      'images':['https://img1.baidu.com/it/u=1699929707,733321099&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800','https://img2.baidu.com/it/u=724223739,2372869883&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800','https://img1.baidu.com/it/u=2812417321,4100104782&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750','https://img2.baidu.com/it/u=1577373388,3492284830&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800'],
      // 点赞数
      'like':204,
      // 评论数
      'comment':2,
      // 是否置顶
      'isTopping':false,
      // 显示评论框
      'showComment':false,
      'id':4
    },
    {
      // 头像
      'avatar':"https://img0.baidu.com/it/u=2685051271,176347936&fm=253&fmt=auto&app=138&f=JPEG?w=475&h=500",
      // 昵称
      'nickName':'陈三聪',
      // 性别 1男 2女
      'gender':1,
      // 年龄
      'age':35,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':1,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'447',
      // 时间
      'createAt':1693139194,
      // 文字内容
      'content':'错有持花梦，不是持花人。',
      // 图片内容
      'images':[],
      // 点赞数
      'like':58,
      // 评论数
      'comment':158,
      // 是否置顶
      'isTopping':false,
      // 显示评论框
      'showComment':false,
      'id':3
    },
  ];
  //  置顶列表-最近
  List topListNear=[
    {
      // 头像
      'avatar':"https://img2.baidu.com/it/u=175449109,3788073609&fm=253&fmt=auto&app=138&f=JPEG?w=561&h=500",
      // 昵称
      'nickName':'安琪拉',
      // 性别 1男 2女
      'gender':2,
      // 年龄
      'age':24,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':1,
      // 用户是否会员
      'isMember':true,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':5,
      // 距离
      'distance':'28',
      // 时间
      'createAt':1693139070,
      // 文字内容
      'content':'我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！我来了！',
      // 图片内容
      'images':['https://img2.baidu.com/it/u=638285213,1746517464&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800','https://img2.baidu.com/it/u=862159221,1723036925&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500'],
      // 点赞数
      'like':80,
      // 评论数
      'comment':62,
      // 是否置顶
      'isTopping':true,
      // 显示评论框
      'showComment':false,
      'id':2
    },
    {
      // 头像
      'avatar':"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F9e18d14b-8a44-41b0-97d9-6aed05b70e7f%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695714475&t=e7c29cfaa789fa7cc199601e91d23b2a",
      // 昵称
      'nickName':'琪琪',
      // 性别 1男 2女
      'gender':2,
      // 年龄
      'age':18,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':0,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'856',
      // 时间
      'createAt':1693122984,
      // 文字内容
      'content':'欢迎光临',
      // 图片内容
      'images':['https://img0.baidu.com/it/u=1604010673,2427861166&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889'],
      // 点赞数
      'like':289,
      // 评论数
      'comment':162,
      // 是否置顶
      'isTopping':true,
      // 显示评论框
      'showComment':false,
      'id':1
    },
    {
      // 头像
      'avatar':"https://img1.baidu.com/it/u=3768804500,181908195&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
      // 昵称
      'nickName':'小川',
      // 性别 1男 2女
      'gender':1,
      // 年龄
      'age':22,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':3,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'15985',
      // 时间
      'createAt':1693139194,
      // 文字内容
      'content':'今天天气真好，一起玩游戏吧。今天天气真好，一起玩游戏吧。今天天气真好，一起玩游戏吧。',
      // 图片内容
      'images':[],
      // 点赞数
      'like':52289,
      // 评论数
      'comment':1628,
      // 是否置顶
      'isTopping':true,
      // 显示评论框
      'showComment':false,
      'id':3
    },
  ];
//  普通列表-最近
  List normalListNear=[
    {
      // 头像
      'avatar':"https://img0.baidu.com/it/u=2685051271,176347936&fm=253&fmt=auto&app=138&f=JPEG?w=475&h=500",
      // 昵称
      'nickName':'陈三聪',
      // 性别 1男 2女
      'gender':1,
      // 年龄
      'age':35,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':1,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'447',
      // 时间
      'createAt':1693139194,
      // 文字内容
      'content':'错有持花梦，不是持花人。',
      // 图片内容
      'images':[],
      // 点赞数
      'like':58,
      // 评论数
      'comment':158,
      // 是否置顶
      'isTopping':false,
      // 显示评论框
      'showComment':false,
      'id':3
    },
    {
      // 头像
      'avatar':"https://img0.baidu.com/it/u=4046953384,453855082&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
      // 昵称
      'nickName':'小玲小龙',
      // 性别 1男 2女
      'gender':2,
      // 年龄
      'age':28,
      // 角色 0陪玩师 1用户 2区域合伙人 3商家
      'character':2,
      // 用户是否会员
      'isMember':false,
      // 是否超级会员
      'isSvip':false,
      // 如用户是会员 会员等级
      'level':0,
      // 距离
      'distance':'2688',
      // 时间
      'createAt':1693139480,
      // 文字内容
      'content':'有人走向海 ，有人走向山 ，都是好风光。',
      // 图片内容
      'images':['https://img1.baidu.com/it/u=1699929707,733321099&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800','https://img2.baidu.com/it/u=724223739,2372869883&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800','https://img1.baidu.com/it/u=2812417321,4100104782&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=750','https://img2.baidu.com/it/u=1577373388,3492284830&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800'],
      // 点赞数
      'like':204,
      // 评论数
      'comment':2,
      // 是否置顶
      'isTopping':false,
      // 显示评论框
      'showComment':false,
      'id':4
    },
  ];
//  付费置顶模式
//  0 一小时18元
//   1 6小时88元
//   2 12小时158元
  int payType=0;

  @override
  void initState() {
    super.initState();
    topListNew.addAll(normalListNew);
    setState(() {
      list=topListNew;
    });
    topListNear.addAll(normalListNear);
  }

  //  执行刷新(下拉刷新)
  Future<void> refreshList() async {

  }

  @override
  Widget build(BuildContext context) {
    queryData = MediaQuery.of(context);
    final EdgeInsets padding = MediaQuery.of(context).padding;
    double viewportHeight = queryData.size.height -110 - padding.bottom - padding.top;
    double height11 = 52+padding.top;

    // 主框
    return Scaffold(
        body: SingleChildScrollView(
          child: Container(
            width: double.infinity,
            child: Column(
              children: [
                // 顶部导航栏
                TopBox(padding,height11),
//                动态列表
                ListBox(viewportHeight,padding),
              ],
            ),
          )
        )
    );
  }

//  顶部导航栏tabbar
  Widget TopBox(padding,height11){
    return Container(
        width: double.infinity,
        height: height11,
        color: Colors.white,
        padding: EdgeInsets.fromLTRB(18, 0, 20, 10),
        child:Container(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                GestureDetector(
                    onDoubleTap: (){
                      _scrollController.jumpTo(0);//点击按钮回调顶部
                      _scrollController.animateTo(0,
                          duration: Duration(
                              milliseconds: 1000
                          ),
                          curve: Curves.easeOut);
                    },
                    child: Container(

                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.end,
                        children: [
                          // tabbar内容
                          TabbarBox(),
                          // 发布按钮
                          GestureDetector(
                            onTap:(){},
                            child:Container(
                              padding: EdgeInsets.fromLTRB(15, 5, 15, 5),
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(50),
                                  color: Color(0x7f800080),
                                ),
                                child:Text('发动态',style: TextStyle(fontSize: 14,color: Colors.white),)
                            ) ,
                          )
                        ],
                      ),
                    )
                ),
              ],
            )
        )
    );
  }

  // tabbar内容
  Widget TabbarBox(){
    return Container(
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          GestureDetector(
            onTap: (){
              setState(() {
                TabbarIndex=0;
                list=topListNew;
              });
            },
            child: Container(
                margin: EdgeInsets.fromLTRB(0, 0, 24, 0),
                child:Container(
                  child:TabbarIndex==0 ? ShaderMask(
                      shaderCallback: (Rect bounds) {
                        return const LinearGradient(
                          begin: Alignment.topCenter,
                          end: Alignment.bottomCenter,
                          colors: [ Color(0xFF9400D3),Color(0xFFFF00FF)],).createShader(Offset.zero & bounds.size);
                      },
                      blendMode: BlendMode.srcATop,
                      child: Text(
                        "最新",
                        style: TextStyle(fontSize:25, color: const Color(0xffffffff),fontWeight: FontWeight.bold),
                      ),
                  ) : Container(
                    margin: EdgeInsets.only(bottom: 2),
                    child: Text('最新',style: TextStyle(fontSize: 20,color: Color(0xff666666),fontWeight: FontWeight.w600)),
                  ),
                )
            ),
          ),
          GestureDetector(
              onTap: (){
                setState(() {
                  TabbarIndex=1;
                  list=topListNear;
                });
              },
              child:Container(
                child:TabbarIndex==1 ? ShaderMask(
                  shaderCallback: (Rect bounds) {
                    return const LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [ Color(0xFF9400D3),Color(0xFFFF00FF)],).createShader(Offset.zero & bounds.size);
                  },
                  blendMode: BlendMode.srcATop,
                  child: Text(
                    "离我最近",
                    style: TextStyle(fontSize:25, color: const Color(0xffffffff),fontWeight: FontWeight.bold),
                  ),
                ) : Container(
                  margin: EdgeInsets.only(bottom: 2),
                  child: Text('离我最近',style: TextStyle(fontSize: 20,color: Color(0xff666666),fontWeight: FontWeight.w600)),
                ),
              )
          ),
        ],
      ),
    );
  }

//  动态列表内容
  Widget ListBox(viewportHeight,padding){
    return Container(
      width: double.infinity,
      height:viewportHeight,
      child:RefreshIndicator(
        color:Color(0xFF9400D3),
        notificationPredicate: defaultScrollNotificationPredicate,
        onRefresh:  refreshList,
        child:MediaQuery.removePadding(
          removeTop: true,
          context: context,
          child:ScrollConfiguration(
            behavior: MyBehavior(),
            child:Container(
              color: Colors.grey[100],
              height: showLoading ? viewportHeight-40 : viewportHeight,
              child: ListView(
                  controller: _scrollController,
                  physics: new AlwaysScrollableScrollPhysics(),
                  children:[
                     Container(
                       padding: EdgeInsets.only(bottom: 10,top:5),
                       child: Column(
                         children: list.map((value) =>
                         // 动态主体
                         Stack(
                           children: [
                             Container(
                               width: double.infinity,
                               margin: EdgeInsets.only(top: 6),
                               decoration: BoxDecoration(
                                 borderRadius: BorderRadius.circular(15),
                                 color: Colors.white,
                               ),
                               child: Column(
                                 children: [
                                   // 动态基本信息
                                   Container(
                                     padding:value['isTopping'] ? EdgeInsets.fromLTRB(15, 25, 10, 0) : EdgeInsets.fromLTRB(15, 15, 10, 0),
                                     decoration: value['isTopping'] ? BoxDecoration(
                                       borderRadius: BorderRadius.circular(15),
                                       gradient: LinearGradient(
                                         begin: Alignment.topCenter,
                                         end: Alignment.bottomCenter,
                                         colors: [
                                           Color(0xffD8bfD8),
                                           Colors.white,
                                         ],
                                       ),
                                     ) : BoxDecoration(
                                       borderRadius: BorderRadius.circular(15),
                                       color: Colors.white,
                                     ),
                                     child: Row (
                                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                       children: [
                                         GestureDetector(
                                           onTap: (){

                                           },
                                           child: Row(
                                             children: [
                                               // 头像
                                               Container(
                                                 width: 50,
                                                 height: 50,
                                                 margin: EdgeInsets.only(right: 13),
                                                 child: CircleAvatar(
                                                   radius: 50,
                                                   backgroundImage:NetworkImage(value['avatar']),
                                                 ),
                                               ),
                                               Container(
                                                 width:215,
                                                 child: Column(
                                                     crossAxisAlignment: CrossAxisAlignment.start,
                                                     children: [
                                                       Row(
                                                         // mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                         children: [
                                                           // 昵称
                                                           ConstrainedBox(
                                                             constraints:BoxConstraints(
                                                               maxWidth: 160,
                                                             ),
                                                             child: Text(
                                                               value['nickName'],
                                                               style: TextStyle(fontSize: 14,color: Color(0xff101010),fontWeight: FontWeight.bold),
                                                               overflow: TextOverflow.ellipsis,
                                                               maxLines: 1,
                                                             ),
                                                           ),
                                                           // 角色
                                                           Container(
                                                             margin: EdgeInsets.only(left: 7,top: 2),
                                                             child: Text(value['character']==0 ? '陪玩师' : (value['character']==1 ? (value['isSvip'] ? '超级会员' : '会员') : value['character']==2 ? '区域合伙人' : '商家'),style: TextStyle(fontSize: 12,color: Colors.red),),
                                                           ),
                                                         ],
                                                       ),
                                                       Container(
                                                         margin: EdgeInsets.only(top: 4),
                                                         child: Row(
                                                           children: [
                                                             // 性别
                                                             Container(
                                                               padding: EdgeInsets.fromLTRB(6, 1, 6, 1),
                                                               decoration:BoxDecoration(
                                                                 borderRadius: BorderRadius.circular(5),
                                                                 color: value['gender']==1 ? Colors.blue[300] : Colors.red[300],
                                                               ),
                                                               child: Row(
                                                                 crossAxisAlignment: CrossAxisAlignment.center,
                                                                 children: [
                                                                   value['gender']==1 ? Image.asset('images/gender_man.png',width: 12,height: 12,) : Image.asset('images/gender_woman.png',width: 10,height: 10,),
                                                                   Container(
                                                                     margin: EdgeInsets.only(left: 4),
                                                                     child: Text(value['age'].toString(),style: TextStyle(fontSize: 11,color: Colors.white),),
                                                                   )
                                                                 ],
                                                               ),
                                                             ),
                                                             // 会员等级
                                                             value['character']==1 && value['isMember'] ? Container(
                                                               margin: EdgeInsets.only(left: 6),
                                                               padding: EdgeInsets.fromLTRB(8, 1, 8, 1),
                                                               decoration:BoxDecoration(
                                                                   borderRadius: BorderRadius.circular(5),
                                                                   color: value['isSvip'] ? Color(0xf7fff0f5) : Color(0x99ffffe0)
                                                               ),
                                                               child: Row(
                                                                 children: [
                                                                   // value['isSvip'] ? Image.asset('images/svip_icon.png',width: 15,height: 15,) : Image.asset('images/member_level.png',width: 13,height: 13,),
                                                                   Container(
                                                                     margin: EdgeInsets.only(left: 3),
                                                                     child: Text((value['isSvip'] ? 'SVIP' : 'VIP') + (value['isSvip'] ? value['level'].toString() : ''),style: TextStyle(fontSize: 11,fontWeight: FontWeight.bold),),
                                                                   )
                                                                 ],
                                                               ),
                                                             ) : Container(),
                                                             // 发布时间+距离
                                                             Container(
                                                               margin: EdgeInsets.only(left: 10),
                                                               child: Row(
                                                                 children: [
                                                                   Container(
                                                                     child:Text(DynamicTime(value['createAt']),style: TextStyle(fontSize: 12,color: Color(0xff999999),),),
                                                                   ),
                                                                   Container(
                                                                     margin: EdgeInsets.only(right: 3,left: 3,top : 2),
                                                                     child: Text('•',style: TextStyle(fontSize: 11,color: Color(0xff999999),),),
                                                                   ),
                                                                   Container(
                                                                       child: Text(DynamicDistance(value['distance']),style: TextStyle(fontSize: 12,color: Color(0xff999999),),)
                                                                   )
                                                                 ],
                                                               ),
                                                             )
                                                           ],
                                                         ),
                                                       )
                                                     ]
                                                 ),
                                               )
                                             ],
                                           ),
                                         ),
                                         // 付费置顶按钮
                                         GestureDetector(
                                           onTap: (){
                                             showModalBottomSheet(
                                               context: context,
                                               builder: (BuildContext context) {
                                                 return StatefulBuilder(
                                                     builder: (context, setState) {
                                                       return Container(
                                                         width: double.infinity,
                                                         // height: 400,
                                                         padding: EdgeInsets.fromLTRB(15, 20, 15, 20),
                                                         decoration:BoxDecoration(
                                                           borderRadius: BorderRadius.circular(10),
                                                           color: Colors.white,
                                                           gradient: LinearGradient(
                                                             begin: Alignment.topCenter,
                                                             end: Alignment.bottomCenter,
                                                             colors: [
                                                               Color(0xffD8bfD8),
                                                               Colors.white,
                                                             ],
                                                           ),
                                                         ),
                                                         child: Column(
                                                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                           children: [
                                                             Column(
                                                               children: [
                                                                 Row(
                                                                   children: [
                                                                     Container(
                                                                       width: 60,
                                                                       height: 60,
                                                                       margin: EdgeInsets.only(right: 15),
                                                                       child: CircleAvatar(
                                                                         radius: 50,
                                                                         backgroundImage:NetworkImage(avatar),
                                                                       ),
                                                                     ),
                                                                     Column(
                                                                       crossAxisAlignment: CrossAxisAlignment.start,
                                                                       children: [
                                                                         Text(nickname,style: TextStyle(fontSize: 18,fontWeight: FontWeight.bold),),
                                                                         Container(
                                                                           margin: EdgeInsets.only(top: 5),
                                                                           child: Text('付费即享置顶特权',style: TextStyle(fontSize: 15,color: Colors.white),),
                                                                         )
                                                                       ],
                                                                     )
                                                                   ],
                                                                 ),
                                                                 Container(
                                                                   margin: EdgeInsets.only(top: 20),
                                                                   child: Row(
                                                                     mainAxisAlignment: MainAxisAlignment.spaceAround,
                                                                     children: [
                                                                       Expanded(
                                                                         flex: 1,
                                                                         child: GestureDetector(
                                                                           onTap:(){
                                                                             setState(() {
                                                                               payType=0;
                                                                             });
                                                                           },
                                                                           child: Container(
                                                                             margin: EdgeInsets.fromLTRB(4, 0, 2, 0),
                                                                             alignment: Alignment.center,
                                                                             height: 200,
                                                                             decoration:BoxDecoration(
                                                                                 borderRadius: BorderRadius.circular(15),
                                                                                 color: payType==0 ? Colors.blue[50] : Colors.white,
                                                                                 border: payType==0 ? new Border.all(width: 2, color: Color(0x7f1e90ff)) : new Border.all(width: 0, color: Colors.grey),
                                                                                 boxShadow: [
                                                                                   BoxShadow(
                                                                                     color: Color(0x4c1e90ff),  //底色,阴影颜色
                                                                                     offset: Offset(5, 5), //阴影位置,从什么位置开始
                                                                                     blurRadius: 6,  // 阴影模糊层度
                                                                                     spreadRadius: 0,  //阴影模糊大小
                                                                                   )]
                                                                             ),
                                                                             child: Column(
                                                                               mainAxisAlignment: MainAxisAlignment.center,
                                                                               crossAxisAlignment: CrossAxisAlignment.center,
                                                                               children: [
                                                                                 Text('1 小时',style: TextStyle(fontSize: 22,color: payType==0 ? Colors.blue : Colors.grey),),
                                                                                 Container(
                                                                                   margin: EdgeInsets.only(top: 15),
                                                                                   child: Text('￥18',style: TextStyle(fontSize: 28,fontWeight: FontWeight.bold,color: Colors.blue),),
                                                                                 )
                                                                               ],
                                                                             ),
                                                                           ),
                                                                         ),
                                                                       ),
                                                                       Expanded(
                                                                         flex: 1,
                                                                         child: GestureDetector(
                                                                           onTap:(){
                                                                             setState(() {
                                                                               payType=1;
                                                                             });
                                                                           },
                                                                           child: Container(
                                                                             margin: EdgeInsets.fromLTRB(3, 0, 3, 0),
                                                                             alignment: Alignment.center,
                                                                             height: 200,
                                                                             decoration:BoxDecoration(
                                                                                 borderRadius: BorderRadius.circular(15),
                                                                                 color: payType==1 ? Colors.blue[50] : Colors.white,
                                                                                 border: payType==1 ? new Border.all(width: 2, color: Color(0x7f1e90ff)) : new Border.all(width: 0, color: Colors.grey),
                                                                                 boxShadow: [
                                                                                   BoxShadow(
                                                                                     color: Color(0x4c1e90ff),  //底色,阴影颜色
                                                                                     offset: Offset(5, 5), //阴影位置,从什么位置开始
                                                                                     blurRadius: 6,  // 阴影模糊层度
                                                                                     spreadRadius: 0,  //阴影模糊大小
                                                                                   )]
                                                                             ),
                                                                             child: Column(
                                                                               mainAxisAlignment: MainAxisAlignment.center,
                                                                               crossAxisAlignment: CrossAxisAlignment.center,
                                                                               children: [
                                                                                 Text('6 小时',style: TextStyle(fontSize: 22,color: payType==0 ? Colors.blue : Colors.grey),),
                                                                                 Container(
                                                                                   margin: EdgeInsets.only(top: 15),
                                                                                   child: Text('￥88',style: TextStyle(fontSize: 28,fontWeight: FontWeight.bold,color: Colors.blue),),
                                                                                 )
                                                                               ],
                                                                             ),
                                                                           ),
                                                                         ),
                                                                       ),
                                                                       Expanded(
                                                                         flex: 1,
                                                                         child: GestureDetector(
                                                                           onTap:(){
                                                                             setState(() {
                                                                               payType=2;
                                                                             });
                                                                           },
                                                                           child: Container(
                                                                             margin: EdgeInsets.fromLTRB(2, 0, 4, 0),
                                                                             alignment: Alignment.center,
                                                                             height: 200,
                                                                             decoration:BoxDecoration(
                                                                                 borderRadius: BorderRadius.circular(15),
                                                                                 color: payType==2 ? Colors.blue[50] : Colors.white,
                                                                                 border: payType==2 ? new Border.all(width: 2, color: Color(0x7f1e90ff)) : new Border.all(width: 0, color: Colors.grey),
                                                                                 boxShadow: [
                                                                                   BoxShadow(
                                                                                     color: Color(0x4c1e90ff),  //底色,阴影颜色
                                                                                     offset: Offset(5, 5), //阴影位置,从什么位置开始
                                                                                     blurRadius: 6,  // 阴影模糊层度
                                                                                     spreadRadius: 0,  //阴影模糊大小
                                                                                   )]
                                                                             ),
                                                                             child: Column(
                                                                               mainAxisAlignment: MainAxisAlignment.center,
                                                                               crossAxisAlignment: CrossAxisAlignment.center,
                                                                               children: [
                                                                                 Text('12 小时',style: TextStyle(fontSize: 22,color: payType==0 ? Colors.blue : Colors.grey),),
                                                                                 Container(
                                                                                   margin: EdgeInsets.only(top: 15),
                                                                                   child: Text('￥158',style: TextStyle(fontSize: 28,fontWeight: FontWeight.bold,color: Colors.blue),),
                                                                                 )
                                                                               ],
                                                                             ),
                                                                           ),
                                                                         ),
                                                                       ),
                                                                     ],
                                                                   ),
                                                                 )
                                                               ],
                                                             ),
                                                             Container(
                                                               child: Column(
                                                                 children: [
                                                                   Container(
                                                                     margin: EdgeInsets.only(bottom: 10),
                                                                     child: Text('需知：置顶后有用户继续置顶将会按照时间顺序进行排序置顶。',style: TextStyle(fontSize: 12),),
                                                                   ),
                                                                   Container(
                                                                     margin: EdgeInsets.only(bottom: 10),
                                                                     alignment: Alignment.center,
                                                                     width: double.infinity,
                                                                     padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
                                                                     decoration:BoxDecoration(
                                                                       borderRadius: BorderRadius.circular(50),
                                                                       color: Colors.blue,
                                                                     ),
                                                                     child: Text('确认协议并以￥' + (payType==0 ? '18' : (payType==1 ? '88' : '158')) + '支付',style:TextStyle(fontSize: 20,color: Colors.white)),
                                                                   ),
                                                                   Row(
                                                                     mainAxisAlignment: MainAxisAlignment.center,
                                                                     children: [
                                                                       Text('购买前阅读',style: TextStyle(fontSize: 14,color: Colors.grey),),
                                                                       GestureDetector(
                                                                         onTap:(){},
                                                                         child: Text('《xxx协议》',style: TextStyle(fontSize: 14,color: Colors.blue),),
                                                                       )
                                                                     ],
                                                                   ),
                                                                 ],
                                                               ),
                                                             )
                                                           ],
                                                         ),
                                                       );
                                                     }
                                                 );
                                               },
                                             );
                                           },
                                           child: Container(
                                             // width: 24,
                                             // height: 24,
                                             padding: EdgeInsets.fromLTRB(8, 1, 8, 1),
                                             decoration:BoxDecoration(
                                                 borderRadius: BorderRadius.circular(50),
                                                 color: Color(0x7fff8c00),
                                                 boxShadow: [
                                                   BoxShadow(
                                                     color: Color(0xb2c0c0c0),  //底色,阴影颜色
                                                     offset: Offset(5, 5), //阴影位置,从什么位置开始
                                                     blurRadius: 10,  // 阴影模糊层度
                                                     spreadRadius: 0,  //阴影模糊大小
                                                   )]
                                             ),
                                             child: Row(
                                               children: [
                                                 Image.asset('images/gold_icon.png',width: 25,height: 25,),
                                                 Container(
                                                   margin: EdgeInsets.only(left: 2),
                                                   child: Text('置顶',style: TextStyle(fontSize: 12),),
                                                 )
                                               ],
                                             ),
                                           ),
                                         )
                                       ],
                                     ),
                                   ),
                                   Container(
                                       padding: EdgeInsets.fromLTRB(15, 0, 13, 0),
                                       child:Column(
                                         children: [
                                           // 动态文字内容
                                           Container(
                                             child: value['content']!='' ? Container(
                                                 alignment: Alignment.centerLeft,
                                                 margin: value['content'].length > 110 ? EdgeInsets.only(bottom: 3,top: 19) : EdgeInsets.only(bottom: 15,top: 19),
                                                 child:RichText(
                                                   softWrap: true,
                                                   textAlign: TextAlign.left,
                                                   // overflow: TextOverflow.ellipsis,
                                                   maxLines: 5,
                                                   text:TextSpan(
                                                     style: TextStyle(fontSize:14,color: Color(0xff333333)),
                                                     children: _getContent(value['content']),
                                                   ),
                                                 )
                                             ) : Container(
                                               margin: EdgeInsets.only(top: 18.5),
                                             ),
                                           ),
                                           value['content'].length > 110 ? GestureDetector(
                                             onTap: (){},
                                             child:
                                             Container(
                                               margin: EdgeInsets.only(bottom: 15,top: 5),
                                               alignment: Alignment.centerLeft,
                                               child:Text('...全文',style: TextStyle(fontSize:14,color: Colors.grey,decoration: TextDecoration.underline),),
                                             )
                                             ,) : Container(),
                                           // 动态图片内容
                                           value['images'].length==0 ? None() : Container(
                                             width: double.infinity,
                                             margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
                                             child: value['images'].length<=2 ? Row(
                                               children: [
                                                 GestureDetector(
                                                   onTap:(){

                                                   },
                                                   child: Container(
                                                     clipBehavior: Clip.hardEdge,
                                                     margin: EdgeInsets.only(right: 5),
                                                     decoration: BoxDecoration(
                                                         borderRadius: BorderRadius.all(Radius.circular(5))
                                                     ),
                                                     child: Image(image: NetworkImage(value['images'][0]),width: 112,height: 112,fit: BoxFit.cover,),
                                                   ),
                                                 ),
                                                 GestureDetector(
                                                   onTap:(){
                                                   },
                                                   child: value['images'].length>1 ? Container(
                                                     clipBehavior: Clip.hardEdge,
                                                     decoration: BoxDecoration(
                                                         borderRadius: BorderRadius.all(Radius.circular(5))
                                                     ),
                                                     child: Image(image: NetworkImage(value['images'][1]),width: 112,height: 112,fit: BoxFit.cover),
                                                   ) : Container(),
                                                 )
                                               ],
                                             ) : Row(
                                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                               children: [
                                                 Expanded(
                                                     flex: 1,
                                                     child: GestureDetector(
                                                       onTap:(){
                                                       },
                                                       child: Container(
                                                         margin: EdgeInsets.only(right: 3.3),
                                                         clipBehavior: Clip.hardEdge,
                                                         decoration: BoxDecoration(
                                                             borderRadius: BorderRadius.all(Radius.circular(5))
                                                         ),
                                                         child: Image(image: NetworkImage(value['images'][0]),width: 112,height: 112,fit: BoxFit.cover),
                                                       ),
                                                     )
                                                 ),
                                                 Expanded(
                                                   flex: 1,
                                                   child : GestureDetector(
                                                     onTap:(){
                                                     },
                                                     child: Container(
                                                       clipBehavior: Clip.hardEdge,
                                                       margin: EdgeInsets.only(right: 1.15,left: 1.15),
                                                       decoration: BoxDecoration(
                                                           borderRadius: BorderRadius.all(Radius.circular(5))
                                                       ),
                                                       child: Image(image: NetworkImage(value['images'][1]),width: 112,height: 112,fit: BoxFit.cover),
                                                     ),
                                                   ),
                                                 ),
                                                 Expanded(
                                                   flex: 1,
                                                   child : Stack(
                                                     alignment: Alignment.bottomRight,
                                                     children: [
                                                       GestureDetector(
                                                         onTap:(){
                                                         },
                                                         child:  Container(
                                                           margin: EdgeInsets.only(left: 3.3),
                                                           clipBehavior: Clip.hardEdge,
                                                           decoration: BoxDecoration(
                                                               borderRadius: BorderRadius.all(Radius.circular(5))
                                                           ),
                                                           child: Image(image: NetworkImage(value['images'][2]),width: 112,height: 112,fit: BoxFit.cover),
                                                         ),
                                                       ),
                                                       value['images'].length<=3 ? Container() : Positioned(
                                                         bottom: 7,
                                                         right: 7,
                                                         child: GestureDetector(
                                                           onTap: (){
                                                           },
                                                           child: Container(
                                                             padding: EdgeInsets.fromLTRB(6, 3,6,3),
                                                             decoration: BoxDecoration(
                                                               borderRadius: BorderRadius.all(Radius.circular(10)),
                                                               color: Color(0xCC000000),
                                                             ),
                                                             child: Row(
                                                               mainAxisAlignment: MainAxisAlignment.center,
                                                               crossAxisAlignment: CrossAxisAlignment.center,
                                                               children: [
                                                                 Container(
                                                                   margin: EdgeInsets.only(right: 2),
                                                                   child: Image(image: NetworkImage('https://file.etsx.site/upload/other/bf00f4972A84ee4a1dC7EBAAF4.png'),width: 11,height: 11,),
                                                                 ),
                                                                 Text(value['images'].length.toString() + '张',style: TextStyle(fontSize: 10,color: Colors.white),)
                                                               ],
                                                             ),
                                                           ),
                                                         ),
                                                       )
                                                     ],
                                                   ),
                                                 ),
                                               ],
                                             ),
                                           ),
                                         ],
                                       )
                                   ),
                                   // 点赞+评论+分享
                                   Container(
                                     padding: EdgeInsets.fromLTRB(15, 0, 15, 15),
                                     margin: EdgeInsets.only(top: 10),
                                     child: Row(
                                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                       children: [
                                         Row(
                                           children: [
                                             GestureDetector(
                                               onTap:(){},
                                               child: Row(
                                                 children: [
                                                   Image.asset('images/like_icon.png',width: 22,height: 22,),
                                                   Container(
                                                     margin: EdgeInsets.only(left: 5,top: 1),
                                                     child: Text(value['like'].toString(),style: TextStyle(fontSize: 12,color: Color(0xff800080)),),
                                                   )
                                                 ],
                                               ),
                                             ),
                                             GestureDetector(
                                               onTap:(){
                                                 int index = list.indexWhere((element) => element['id'] == value['id']);
                                                 bool isShow=list[index]['showComment'];

                                                 for(int i=0;i<list.length;i++){
                                                   setState(() {
                                                     list[i]['showComment']=false;
                                                   });
                                                 }

                                                 if(!isShow) {
                                                   setState(() {
                                                     list[index]['showComment'] =
                                                     !list[index]['showComment'];
                                                   });
                                                 }
                                               },
                                               child: Container(
                                                 margin: EdgeInsets.only(left: 15),
                                                 child: Row(
                                                   children: [
                                                     Image.asset('images/comment_icon.png',width: 22,height: 22,),
                                                     Container(
                                                       margin: EdgeInsets.only(left: 5,top: 1),
                                                       child: Text(value['comment'].toString(),style: TextStyle(fontSize: 12,color: Color(0xff800080)),),
                                                     )
                                                   ],
                                                 ),
                                               ),
                                             ),
                                           ],
                                         ),
                                         GestureDetector(
                                           onTap: (){},
                                           child: Image.asset('images/share_icon.png',width: 22,height: 22,),
                                         )
                                       ],
                                     ),
                                   ),
//                                    评论输入框
                                   value['showComment'] ? Container(
                                     padding: EdgeInsets.fromLTRB(15, 0, 15, 0),
                                     child: Container(
                                       padding: EdgeInsets.fromLTRB(10, 5, 10, 5),
                                       margin: EdgeInsets.only(bottom: 20),
                                       decoration: BoxDecoration(
                                         borderRadius: BorderRadius.circular(10),
                                         border: new Border.all(width: 1, color: Color(0xffD3D3D3)),
                                         color: Colors.white,
                                       ),
                                       constraints: BoxConstraints(minHeight: 0,maxHeight: 100),
                                       child: Row(
                                         mainAxisAlignment: MainAxisAlignment.start,
                                         crossAxisAlignment: CrossAxisAlignment.start,
                                         children: [
                                           Container(
                                             width: 35,
                                             height: 35,
                                             margin: EdgeInsets.only(right: 13,top: 5),
                                             child: CircleAvatar(
                                               radius: 50,
                                               backgroundImage:NetworkImage(avatar),
                                             ),
                                           ),
                                           Expanded(
                                             flex: 1,
                                             child: Container(
                                               child: TextField(
                                                 // focusNode: _focusNode,
                                                 // controller: _controller,
                                                   keyboardType: TextInputType.multiline,
                                                   maxLines: null,
                                                   minLines: 1,
                                                   style: TextStyle(fontSize: 14),
                                                   maxLength: 200,
                                                   // inputFormatters: [
                                                   //   LengthLimitingTextInputFormatter(200)
                                                   // ],
                                                   onChanged: (value){
                                                     if(value==''){
                                                       setState(() {
                                                         btnStatus=0;
                                                       });
                                                     }else{
                                                       setState(() {
                                                         btnStatus=1;
                                                       });
                                                     }
                                                     setState(() {
                                                       commentContent=value;
                                                     });
                                                   },
                                                   decoration: InputDecoration(
                                                     hintText: '走心评论~',
                                                     hintStyle: TextStyle(fontSize: 14,color: Color(0xff727272)),
                                                     border: OutlineInputBorder(borderSide: BorderSide.none),
                                                     contentPadding: EdgeInsets.fromLTRB(0,0,0,0),
                                                     counterText: "",
                                                   )
                                               ),
                                             ),
                                           ),
                                           GestureDetector(
                                             onTap: (){},
                                             child: Container(
                                               padding: EdgeInsets.fromLTRB(15, 5, 15, 5),
                                               margin: EdgeInsets.only(top: 8),
                                               decoration: BoxDecoration(
                                                 borderRadius: BorderRadius.circular(5),
                                                 color: btnStatus==0 ? Colors.grey[200] : Color(0x7F800080),
                                               ),
                                               child: Text('发布',style: btnStatus==0 ? TextStyle(fontSize: 14,color: Colors.grey,fontWeight: FontWeight.bold) : TextStyle(fontSize: 14,color: Colors.white,fontWeight: FontWeight.bold),),
                                             ),
                                           )
                                         ],
                                       ),
                                     ),
                                   ) : Container()
                                 ],
                               ),
                             ),
                             value['isTopping'] ? Positioned(
                               top: 0,
                               right: 0,
                               child: Container(
                                 padding: EdgeInsets.fromLTRB(10, 13, 10, 10),
                                 child: Text('置顶中',style: TextStyle(fontSize: 14,color:Colors.red),),
                               )
                             ) : Container()
                           ],
                         )
                         ).toList(),
                       ),
                     ),
                     showLoading ? Container(
                     alignment: Alignment.center,
                     padding: EdgeInsets.fromLTRB(0, 20, 0, 20), child: Text('~加载中~',style: TextStyle(fontSize: 12,color: Color(0xff999999)),),
                        ) : Container()
                  ]
              ),
            )
          ),
        ),
      ),
    );
  }

  ///使用正则解析表情文本,使用了Text.rich替换掉了Wrap
  _getContent(content) {
    // if (ExpressionData.expressionKV.length == 0) {
    //   ExpressionData.init();
    // }
    List<InlineSpan> stack = [];

    List<int> indexList = [];

    //正则校验是否含有表情
    RegExp exp = new RegExp(r'\[.{1,4}?\]');
    if (exp.hasMatch(content)) {
      var array = exp.allMatches(content).toList();
      for (RegExpMatch r in array) {
        var substring = content.substring(r.start, r.end);
        var select = substring.substring(1, substring.length - 1);
        // if (ExpressionData.expressionKV.containsKey(select)) {
        //   indexList.add(r.start);
        //   indexList.add(r.end);
        // }
      }
      int afterX = 0;
      for (int x = 0; x < indexList.length; x = x + 2) {
        int y = x + 1;
        var indexX = indexList[x];
        var indexY = indexList[y];
        var substring = content.substring(afterX, indexX);
        afterX = indexY;
        stack.add(TextSpan(
          text: substring,
          // style: _textStyle,
        ));
        var xy = content.substring(indexX, indexY);
        var selectXy = xy.substring(1, xy.length - 1);
        // var expressionKV = ExpressionData.expressionKV[selectXy];
        // stack.add(WidgetSpan(
        //   child: Image.asset(
        //     'assets/expression/$expressionKV',
        //     width: 20.0,
        //     height: 20.0,
        //   ),
        // ));
      }
      if (afterX < (content.length - 1)) {
        //拼接剩下的字符串
        var substring = content.substring(afterX);
        stack.add(TextSpan(
          text: substring,
          // style: _textStyle,
        ));
      }
    } else {
      stack.add(TextSpan(
        text: content,
        // style: _textStyle,
      ));
    }

    return stack;
  }

  Widget None(){
    return Container();
  }
}